<template>
  <view v-if="shenheStatus == 0" class="teamBox">
    <view class="content">
      <view class="title">
        {{ $t("share.team") }}({{ count }}{{ $t("share.people") }})
      </view>
      <treeItem
        v-for="(item, index) in list"
        :key="index"
        :tree="item"
      ></treeItem>
    </view>
  </view>
  <Shenhe v-else-if="shenheStatus == 1"></Shenhe>
</template>

<script>
import Shenhe from "@/components/shenhe/shenhe";
import treeItem from "./components/treeItem.vue";
export default {
  components: {
    Shenhe,
    treeItem,
  },
  data() {
    return {
      // 团队列表
      list: [],
      // 团队总人数
      count: 0,
      type: "",
    };
  },
  methods: {
    // 获取团队列表
    async group() {
      const res = await this.$allrequest.shareholder.group({
        type: this.type,
      });
      if (res.code == 0) {
        this.count = res.data.count;
        this.list = res.data.res;
      }
    },
  },

  onLoad(opi) {
    if (opi.type) {
      this.type = opi.type;

      if (parseInt(this.type) === 2) {
        uni.setNavigationBarTitle({
          title: "出局老板列表",
        });
      }
    }
    this.group();
  },
};
</script>

<style lang="less" scoped>
.teamBox {
  min-height: 100vh;
  background: #f2f2f2;
  padding-top: 24rpx;
  color: #262626;
  font-family: PingFang SC;
  .content {
    padding: 0 30rpx;
    background-color: #fff;
  }
  .title {
    height: 100rpx;
    display: flex;
    align-items: center;
    font-size: 30rpx;
  }
}
</style>
